import {
  wxRequest
} from '@/utils/wxRequest';

let env = "-test" //-dev 或者 -test
const apiMall = 'http://localhost:8089/'
// const apiMall = 'https://www.fwpiano.com/api'
// const apiMall = 'http://192.168.2.188:8089'


/**
 * 获取发现好商品接口
 * @param  {[type]} params [description]
 * @return {[type]}        [description]
 */
const getDiscoverList = (params) => wxRequest(params, apiMall + '/goods/list?cateidOne=1&cateidTwo=0&price=0&sales=2');

//微信的jscode换取sessionKey
const wxJsCode2Session = (params) => wxRequest(params, apiMall + "/wx/mini/jscode2session");
const user2session = (params) => wxRequest(params, apiMall + "/api/wechat/user2session?jsoncallback=?");


//查询课程列表
const getClassList = (params) => wxRequest(params, apiMall + '/api/course/list');

//查询课程列表,按日期分组
const getClassListByDay = (params) => wxRequest(params, apiMall + '/api/course/list/day');
//获取老师列表
const getTeacherList = (params) => wxRequest(params, apiMall + '/api/teacher/list/time');
//获取老师列表
const getTeacherListCount = (params) => wxRequest(params, apiMall + '/api/teacher/list/count');
//查询我的订单
const getMyReserveList = (params) => wxRequest(params, apiMall + '/api/reserve/list');
//预约课程
const reserveCourse = (params) => wxRequest(params, apiMall + '/api/course/reserve');
//评论课程
const commentReserve =  (params) => wxRequest(params, apiMall + '/api/reserve/comment');

//用户手机绑定
const registerUser = (params) => wxRequest(params, apiMall + '/api//member/bindMini');
//发送短信
const sendRandCode = (params) => wxRequest(params, apiMall + '/api/sms/send');

//用户是否绑定手机号
const getUserInfo = (params) => wxRequest(params, apiMall + '/api/member/mini');
//学员取消预约
const cancelReserve = (params) => wxRequest(params, apiMall + '/api/reserve/cancel');
//查看评价
const getHomework = (params) => wxRequest(params, apiMall + '/api/reserve/homework');
//获取某个课程的时间表
const getClassTimeList = (params) => wxRequest(params, apiMall + '/api/course/time/list');

//合同信息
const getAgreementInfo = (params) => wxRequest(params, apiMall + '/api/agreement/info');
//暂停信息
const getAgreementPauseList = (params) => wxRequest(params, apiMall + '/api/agreement/list');

const pauseCourse = (params) => wxRequest(params, apiMall + '/api/agreement/pause');

const resumeCourse = (params) => wxRequest(params, apiMall + '/api/agreement/resume');


export default {
  getDiscoverList,
  wxJsCode2Session,
  user2session,
  getClassList,
  getMyReserveList,
  reserveCourse,
  commentReserve,
  registerUser,
  sendRandCode,
  getUserInfo,
  cancelReserve,
  getHomework,
  getClassTimeList,
  getClassListByDay,
  getTeacherList,
  getTeacherListCount,
  getAgreementInfo,
  getAgreementPauseList,
  pauseCourse,
  resumeCourse
}
